package com.jucai.pppeiyouclient.adapter;

import android.content.Context;

import com.jucai.pppeiyouclient.R;
import com.jucai.pppeiyouclient.base.CommonRecyclerViewAdapter;
import com.jucai.pppeiyouclient.bean.SystemNewsBean;

import java.util.List;

import static java.lang.String.valueOf;

/**
 * Created by Kuky on 2017-05-04.
 */

public class SystemNewsAdapter extends CommonRecyclerViewAdapter<SystemNewsBean> {
    public SystemNewsAdapter(Context context, List<SystemNewsBean> data) {
        super(context, data);
    }

    @Override
    public void bindHolder(CommonHolder holder, SystemNewsBean systemNewsBean) {
        holder.setText(R.id.system_news_title, systemNewsBean.getMail_title());
        holder.setText(R.id.system_news_time, systemNewsBean.getMail_createtime_str());
        holder.setText(R.id.system_news_content, systemNewsBean.getMail_text());
        if (Integer.parseInt(systemNewsBean.getMail_read_status()) == 0) {
            holder.setImage(R.id.system_status, R.drawable.system_unread, 15, 15);
        } else if (Integer.parseInt(systemNewsBean.getMail_read_status()) == 1) {
            holder.setImage(R.id.system_status, R.drawable.system_read, 15, 15);
        }
    }

    @Override
    protected int getItemType(int position) {
        return 0;
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_system_news_layout;
    }
}
